<template>
	<view class="address-manage">
		<view class="order-address" v-for="(item,index) in address" :key="index">
			<view class="uni-icon uni-icon-checkbox-filled icon-check" :style="{'visibility': item.use && item.edit===false?'visible':'hidden'}"></view>
			<view class="" @tap="toAddressNew(item.edit)">
				<view class="order-address-t">
					<text>收货人: {{item.receiver}}</text>
					<text class="address-phone">{{item.phone}}</text>
				</view>
				<view class="order-address-b">
					<text>收货地址: {{item.address}}</text>
				</view>
			</view>
			<view v-if="item.edit" class="uni-icon uni-icon-arrowright icon-right"></view>
		</view>
		<view class="address-manage-add" @tap="toAddressNew">
			新增地址
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				address: [
					{
						receiver: "张小三",
						phone: "13800138000",
						address: "山东省淄博市张店区阳光国际A座601",
						use: true,
						edit:false,
					},
					{
						receiver: "张小三",
						phone: "13800138000",
						address: "山东省淄博市张店区阳光国际A座601",
						use: false,
						edit:false,
					},
					{
						receiver: "张小三",
						phone: "13800138000",
						address: "山东省淄博市张店区阳光国际A座601",
						use: false,
						edit:false,
					}
				]
			}			
		},
		methods:{
			toAddressNew(jump){
				if (jump === false) {
					return 
				}
				uni.navigateTo({
					url:'/pages/own/address-new'
				})
			}
		},
		onNavigationBarButtonTap(e) {
			for (var i = 0; i < this.address.length; i++) {
				this.address[i].edit = !this.address[i].edit
			}
		},
	}
</script>

<style lang="scss">
	.address-manage {
		width: 100%;
		box-sizing: border-box;
		color: #666666;
		
		
		.order-address {
			padding: 20upx;
			position: relative;
			font-size: 14px;
			border-bottom: 1px solid rgba(242, 242, 242, 1);
			display: flex;
			flex-direction: row;
			justify-content: flex-start;
			align-items: center;

			.icon-check{
				font-size: 20px;
				padding-right: 10upx;
			}


			.icon-right {
				position: absolute;
				top: 43%;
				right: 2%;
				font-size: 18px;
			}

			.address-phone {
				padding-left: 40upx;
				// font-weight: bold;
				font-size: 14px;
			}
		}

		.order-address-t {
			display: flex;
			flex-direction: row;
			justify-content: flex-start;
		}
		
		.address-manage-add {
			border: 1px solid red;
			position: fixed;
			z-index: 2;
			bottom: 0%;
			box-shadow: 0px -2px 5px rgba(94, 94, 94, 0.3);
			background-color: rgba(242, 68, 57, 1);;
			width: 100%;
			box-sizing: border-box;
			display: flex;
			flex-direction: row;
			justify-content: space-around;
			align-items: center;
			color: #FFFFFF;
			height: 100upx;
		}
	}
</style>
